// JavaScript Document
function showMenu(menuid) {          
	var screenwidth, screenheight, mytop, getPosLeft, getPosTop          
	screenwidth    = $(window).width();          
	screenheight   = $(window).height();                 //获取滚动条距顶部的偏�  
	mytop          = $(document).scrollTop();            //计算弹出层的left  
	var pos        = getElementPos(menuid);
	var obj        = document.getElementById(menuid);    
	getPosLeft     = pos.x+ obj.offsetWidth  ;           //计算弹出层的top        
	getPosTop      = pos.y + 5;                          //css定位弹出�     
	$("#ItemContenter").css({ "left": getPosLeft, "top": getPosTop });          //当浏览器窗口大小改变� 
	$("#menu_close").click( function(){  
	    $("#ItemContenter").css({"display" : "none"});
	});
} 
	
 function showCreateInfo(itemClassName){
    var screenwidth, screenheight, mytop, getPosLeft, getPosTop          
	screenwidth     = $(window).width();          
	screenheight    = $(window).height();                    //获取滚动条距顶部的偏�   
	mytop           = $(document).scrollTop();               //计算弹出层的left  
	var myheight    = $("#ItemAddContenter").height();
	var mywidth     = $("#ItemAddContenter").width(); 
	getPosLeft      = (screenwidth - mywidth)/2;             //计算弹出层的top        
	getPosTop       = (screenheight - myheight)/2 -30; 
	$("#ItemAddContenter").css({ "left": getPosLeft, "top": getPosTop });
	
	showCover()
	$("#coverDiv").css("display", "block");                         //css定位弹出�?  
	$("#ItemAddContenter").css("display", "block");
	$("#createInfo_close").click( function(){  
	     $("#ItemAddContenter").css({"display" : "none"});
	     $("#CreateButton").removeAttr("disabled");                //当include为空时会将Create按钮失效，在这里将他恢复
	     hideCover();
	});
	
  }
  
  function hideCreateInfo(){
  	$("#ItemAddContenter").css({"display" : "none"});
  	$("#CreateButton").removeAttr("disabled");                   //当include为空时会将Create按钮失效，在这里将他恢复
	hideCover();
  }
  
  function showCover(){
  	$("#coverDiv").css("display", "block"); 
  	$("#coverDiv").css({ "height": document.body.scrollHeight});
  }
  function hideCover(){
  	$("#coverDiv").css("display", "none"); 
  }
  
 function chooseItem(nodeLevel , itemClassName , NodeName){
      if( "null" == itemClassName ) {
      	  $("#ItemContenter").css("display", "none"); 
      	  return ;                                          //没有可增加的节点时直接返�
      }
      data = ajaxMml;
      $("#createInfo_title").html("");
      var nodeDisplay = NodeName;
      if("son" == nodeDisplay) nodeDisplay = "Node";
      $("#createInfo_title").append("Add a new <span style='color:red'>"+nodeDisplay+"</span>");
      
      $("#Itme_add").html("");
      document.getElementById("nodeLevel").value = nodeLevel;
      document.getElementById("itemClassName").value = itemClassName;
      document.getElementById("currNodeName").value = NodeName;
      $(data).find(NodeName+"_FieldItem").each(function(index, element) {
            var FieldName     = $(this).children("FieldName").text();
			var FieldType     = $(this).children("FieldType").text();
			var FieldTValues  = $(this).children("FieldTValues").text();
			//var attr_leaf     = $(this).attr("is_leaf");
			$("#Itme_add").append("<span class='fieldSpan'>"+FieldName+":</span>");
			if("" != FieldTValues){
				$("#Itme_add").append("<select style='width:305px;   height:23px;' id='"+FieldName+"' name = '"+FieldName+"' class='inputSelect' >"+getValuesList(FieldTValues));
				$("#Itme_add").append("</select>");
			}else{
				if("include" == nodeDisplay ){
					$("#Itme_add").append("<span style='color:red;'>请先导入相应模块后在进行这个操作</span>");
					$("#CreateButton").attr("disabled","disabled");
				}else{
				        $("#Itme_add").append("<input type='text' class='inputText' id = '"+FieldName+"' name = '"+FieldName+"' value='' />");
		        	}
			}
			$("#Itme_add").append("<span class='paramClass'>("+FieldType+")</span>");
      });
      $("#ItemContenter").css("display", "none");
      if($("#Itme_add").html().trim() == ""){
      	submitForm();
      	return;
      }
	  showCreateInfo(itemClassName);
 }
 /**************************************************************************************
 ***************** 文件保存部分 Begin ****************************************************/
 function showValidateForSave(xmlData){
 	var screenwidth, screenheight, mytop, getPosLeft, getPosTop          
	screenwidth     = $(window).width();          
	screenheight    = $(window).height();                    //获取滚动条距顶部的偏�移    
	mytop           = $(document).scrollTop();               //计算弹出层的left  
	var myheight    = $("#SaveModuleToDBDiv").height();
	var mywidth     = $("#SaveModuleToDBDiv").width(); 
	getPosLeft      = (screenwidth - mywidth)/2;             //计算弹出层的top        
	getPosTop       = (screenheight - myheight)/2 -30; 
	$("#SaveModuleToDBDiv").css({ "left": getPosLeft, "top": getPosTop });
	showCover();
	$("#SaveModuleToDBDiv").css("display", "block");
	$("#Validate_close").click( function(){  
	     $("#SaveModuleToDBDiv").css({"display" : "none"});
	     hideCover();
	});
	var AbsoultePath ="";
	var Description ="";
	$("#SaveValidateInfo").html("");
	$(xmlData).find("noticeMessage").each(function(index, element) {
    	Description      = $(this).children("Description").text();
    	$("#SaveValidateInfo").append(
    	 Description
    	 +"<br/><br/>"
    	);
    });
 }
 
 function hideValidateForSave(){
 	hideCover();
 	$("#SaveModuleToDBDiv").css("display", "none");
 }
 /**************************************************************************************
 ***************** 文件保存部分 End ******************************************************/
 
 
 /**************************************************************************************
 ***************** 文件保存部分 Begin ****************************************************/
 function showStateNotice(){
 	var screenwidth, screenheight, mytop, getPosLeft, getPosTop          
	screenwidth     = $(window).width();          
	screenheight    = $(window).height();                    //获取滚动条距顶部的偏�移    
	mytop           = $(document).scrollTop();               //计算弹出层的left  
	var myheight    = $("#OperationStateNotice").height();
	var mywidth     = $("#OperationStateNotice").width(); 
	getPosLeft      = (screenwidth - mywidth)/2;             //计算弹出层的top        
	getPosTop       = (screenheight - myheight)-2;
	$("#OperationStateNotice").css({ "left": getPosLeft, "top": getPosTop });
	$("#OperationStateNotice").css("display", "block");
	$("#StateNotice_close").click( function(){  
	     $("#OperationStateNotice").css({"display" : "none"});
	});
 }
 function hideStateNotice(){
 	$("#OperationStateNotice").css("display", "none");
 }
  /*************** 文件保存部分 End ******************************************************
 ***************************************************************************************/